package com.lanhai.crowd.mapper;

import com.lanhai.crowd.entity.Role;
import com.lanhai.crowd.entity.RoleExample;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

public interface RoleMapper {
    long countByExample(RoleExample example);

    int deleteByExample(RoleExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(Role record);

    int insertSelective(Role record);

    List<Role> selectByExample(RoleExample example);

    Role selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") Role record, @Param("example") RoleExample example);

    int updateByExample(@Param("record") Role record, @Param("example") RoleExample example);

    int updateByPrimaryKeySelective(Role record);

    int updateByPrimaryKey(Role record);

    List<Role> selectRoleByKeyword(String keyword); // 自定义查询

    List<Role> selectAssignedRole(Integer adminId); // 查询已分配角色

    List<Role> selectUnassignedRole(Integer adminId); // 查询未分配角色

    void deleteOldAdminRoleRelationship(Integer adminId); //删除旧的用户角色关系

    void insertNewAdminRoleRelationship(@Param("adminId") Integer adminId, @Param("roleIdList") List<Integer> roleIdList); // 插入新的用户角色关系
}